package com.itxh.core.utils;

import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.io.SAXReader;

import java.io.InputStream;
import java.io.Reader;

public class DocumentUtils {
    public static Document createDocument(InputStream is){
        SAXReader saxReader = new SAXReader();
        try {
            return saxReader.read(is) ;
        } catch (DocumentException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static Document createDocument(Reader reader){
        SAXReader saxReader = new SAXReader();
        try {
            return saxReader.read(reader) ;
        } catch (DocumentException e) {
            e.printStackTrace();
        }
        return null;
    }
}
